<!doctype html>
<html>
    <head>
        <meta charset="UTF-8"/>
        <title>用户管理</title>
        <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">
        <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>
        <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="/webapp/js/lib/jquery.global.settings.js"></script>
        <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
        <script type="text/javascript" src="/webapp/js/common/config.js"></script>
    </head>
    <body>
       <div class="easyui-container-fluid">
          <div class="easyui-panel" style="border: none;">
            <div class="nav" id="nav"></div>
            <div class="easyui-panel" style="border: none;">
                <form id="ff">
                    <div style="margin-bottom:20px">
                        <label class="item-label">部门：</label>
                        <select class="easyui-combobox" data-options="panelHeight:'auto',required:true" name="department"  style="width:174px;">
                            <option value="管理部" >管理部</option>
                            <option value="渠道部">渠道部</option>
                            <option value="产品部" selected>产品部</option>
                            <option value="销售部">销售部</option>
                        </select>
                        <label class="item-label">用户名：</label>
                        <input type="text" name="username" class="easyui-textbox" placeholder="用户名" />
                        <label class="item-label">状态：</label>
                        <input id="entityStatus" class="easyui-switchbutton" checked style="width:80px;height:30px;" onText="启用" offText="禁用"  >
                    </div>
                    <div style="margin-bottom:20px;text-align:center;">
                        <a href="javascript:void(0);" onclick="searchBy()" class="easyui-linkbutton c8" style="width:80px;">查询</a>
                    </div>
                </form>
            </div>
            <div class="table-wrapper">
             <table id="datagrid" data-options="fitColumns:true,scrollbarSize:0">
               <thead>
                 <tr>
                     <th data-options="field:'username',align:'center'" width="80">用户名</th>
                     <th data-options="field:'department',align:'center'" width="80">部门</th>
                     <th data-options="field:'mobile',align:'center'" width="100">电话</th>
                     <th data-options="field:'lastLoginTime',formatter:timeFormatter,align:'center'" width="100">最后登录时间</th>
                     <th data-options="field:'ip',align:'center'" width="100">最后登录IP</th>
                     <th data-options="field:'entityStatus',formatter:statusFormatter,align:'center'" width="80">状态</th>
                     <th data-options="field:'action',align:'center',formatter:actions" width="160">操作</th>
                 </tr>
               </thead>
               <tbody>
               </tbody>
             </table>
           </div>
          </div> 
       </div>

        <!--<br>****非技术人员请勿使用****-->
        <!--<br>初始化均价表-->
        <!--<select class="easyui-combobox" id="year" data-options="panelHeight:'auto'" style="width: 130px;" prompt="请选择年份">-->
            <!--<option value=""></option>-->
            <!--<option value="2019">2019</option>-->
            <!--<option value="2018">2018</option>-->
        <!--</select>-->
        <!--<select class="easyui-combobox" id="report" data-options="panelHeight:'auto'" style="width: 130px;">-->
            <!--<option value="" selected="selected">&#45;&#45;请选择&#45;&#45;</option>-->
            <!--<option value="month">月报</option>-->
            <!--<option value="week">周报</option>-->
            <!--<option value="online">电商</option>-->
        <!--</select>-->
        <!--<input type="button" class="easyui-linkbutton" value="初始化" onclick="initAvgPrice()" style="height: 32px;width:60px;"/>-->
    </body>
    <script type="text/javascript" src="/webapp/js/common/pagelist.js"></script>
    <script type="text/javascript">
        $(function () {
           var height = $(window).height();
           var nav_height = $("#nav")._outerHeight();
           var ff_height = $("#ff").height();
           var table_height = height-nav_height-ff_height-40;
           $("#datagrid").css("max-height",table_height);
           $("#datagrid").datagrid({
               toolbar:[{
                   text:'添加用户',
                   handler:function(){
                       window.parent.addTab("添加用户","/webapp/pages/system/user/add.html");
                       // window.location.href = ;
                   }
               }]
           });
        });

        function initAvgPrice(){

            var year = $("#year").combobox('getValue');
            var report = $("#report").combobox('getValue');
            if (!year || year == "") {
                alert("请选择年份")
                return;
            }
            if (!report || report == "") {
                alert("请选择报告模式")
                return;
            }
            var url = "/initAvgPrice/statistics/"+report+"/"+year;
            $.ajax({
                url:config.url +url,
                type:'get',
                xhrFields:{withCredentials:true},
                beforeSend:function () {
                    $.messager.progress({
                        title:"请稍等",
                        interval:50,
                        text:"均价初始化中..."
                    });
                },
                complete:function () {
                    $.messager.progress("close");
                },
                success:function(data){
                    alert(data);
                },
                error:function(){
                    alert("初始化失败");
                }
            });
        }
        // function actions(val,row,index){
        //     var text = row.entityStatus=="OK"?"禁用":"启用";
        //     return "<a href='javascript:void(0);' class='easyui-linkbutton l-btn l-btn-small' style='width:60px' "+
        //         "onclick='edit(\""+row.id+"\")'>修改</a>&nbsp;&nbsp;"+
        //         "<a href='javascript:void(0);' class='easyui-linkbutton l-btn l-btn-small' style='width:60px' "+
        //         "onclick='updateStatus(\""+row.id+"\")'>"+text+"</a>";
        // }
        function edit(id){
            window.parent.addTab("修改品牌", "/webapp/pages/system/user/add.html?id="+id);
        }
      </script>

</html>
